import Vue from 'vue'
import Vuex from 'vuex'

class wechatX{
    constructor({state,methods}) {
        console.log(state);
        this.state = state;
        this._methods(methods);
    }
    getState(){
        return this.state;
    }

    setState(param){
        let that = this;
        let state = this.state;
        Object.keys(param).some((key,index)=>{
            if(state[key]){
                that.state[key] = param[key]
            }
        })
    }
    _methods(methods){
        Object.keys(methods).forEach((key,value)=>{
            Vue.prototype[key] = methods[key];
        })
    }
}

export default wechatX